home *** CD-ROM | disk | FTP | other *** search
- Path: jupiter.sun.csd.unb.ca!dwoo
- From: dwoo@jupiter.sun.csd.unb.ca (Dennis K. C. Woo)
- Newsgroups: comp.lang.c
- Subject: A question for the C experts..
- Date: 12 Feb 1996 13:17:51 GMT
- Organization: University of New Brunswick, Fredericton, NB, Canada
- Message-ID: <4fnelv$dvp@sol.sun.csd.unb.ca>
- NNTP-Posting-Host: jupiter-alt3.unb.ca
-
- Hi Experts,
-
- In the following code fragment, a sturcture is defined as COMPLEX. The
- argument var1 is defined as a 32-bit word. The lines that marked as
- "offending line" caused the Watcom compiler to complain that "expression
- for '->' must be a pointer to structure or union". However, the variable
- v1 is already declared as a pointer to COMPLEX...why is wrong? I had
- tried to change the COMPLEX declaration to double and everything worked
- fine.
-
- /*
- * VBDLL32.C
- */
- #include <stdio.h>
- #include <windows.h> /* required for all Windows applications */
- typedef struct { double Real ; double Imag ; } COMPLEX ;
-
- long FAR PASCAL Add3( DWORD var1 )
- {
- int i ;
- COMPLEX far *v1 ;
-
- v1 = MK_FP32((void *)var1);
- for( i=0; i<5 ; i++ )
- {
- v1[i]->Real *= 2 ; // offending line
- v1[i]->Imag *= 2 ; // offending line
- }
- return( (long)1 );
-
- }
-
- #pragma off (unreferenced);
- int PASCAL WinMain(HANDLE hInstance, HANDLE x1, LPSTR lpCmdLine, int x2)
- #pragma on (unreferenced);
- {
- DefineDLLEntry( 1, (void *) Add3, DLL_DWORD, DLL_ENDLIST );
- return( 1 );
- }
-
-
- Thanks a million.
-
- Dennis
- *****************************************************************
- * Dennis Woo Department of Mechanical Engineering *
- * E-mail: dwoo@unb.ca University of New Brunswick *
- * Office Tel: (506) 447-3076 -------- __o *
- * Voice mail: (506) 453-0614 ------- _`\<,_ *
- * FAX : (506) 453-5025 ------- (*)/ (*) *
- *****************************************************************
-
-
-